Skip to content

feat: add rsbuild adapter#608

Merged
sxzz merged 6 commits into
unjs:mainfrom
yslpn:feat/rsbuild-adapter
Jun 29, 2026
Merged

feat: add rsbuild adapter#608
sxzz merged 6 commits into
unjs:mainfrom
yslpn:feat/rsbuild-adapter

Conversation

@yslpn

@yslpn yslpn commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #607

  • Adds first-class Rsbuild support via createUnplugin(...).rsbuild and createRsbuildPlugin.
  • Reuses the existing Rspack adapter internally through Rsbuild's modifyRspackConfig hook.
  • Updates public types, docs, fixtures, and version metadata coverage for Rsbuild.
  • Exposes meta.versions.rsbuild and the underlying meta.versions.rspack.

Tests

  • pnpm typecheck
  • pnpm test:build
  • pnpm vitest run
  • pnpm build

Summary by CodeRabbit

  • New Features

    • Added Rsbuild as a supported build tool, including Rsbuild plugin integration and framework typing.
  • Documentation

    • Updated the homepage, README, and guide with Rsbuild in supported lists, compatibility tables, and examples, plus Rsbuild icons/assets.
  • Tests

    • Extended fixtures and unit tests for Rsbuild, covering hook order, transform/load behavior, and virtual-module handling.
  • Chores

    • Updated dependency/workspace and build/test configuration to include Rsbuild support.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ad428aa8-2481-4081-bedb-73362e8acb5f

📥 Commits

Reviewing files that changed from the base of the PR and between f543312 and 7f9028b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • package.json
  • pnpm-workspace.yaml
  • src/types.ts
  • tsdown.config.ts
✅ Files skipped from review due to trivial changes (2)
  • pnpm-workspace.yaml
  • tsdown.config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • package.json
  • src/types.ts

📝 Walkthrough

Walkthrough

Adds a first-class Rsbuild adapter to unplugin. This includes new Rsbuild types, shared rspack wiring reuse, a new Rsbuild adapter, public API additions, fixture and unit test coverage, and documentation updates.

Changes

Rsbuild First-Class Adapter

Layer / File(s) Summary
Rsbuild type definitions and dependency declarations
src/types.ts, package.json, pnpm-workspace.yaml, tsdown.config.ts
Imports and re-exports RsbuildPlugin, adds rsbuild support to unplugin types and framework metadata, and declares @rsbuild/core as a dev/peer dependency and non-bundled dependency.
Rspack hook extraction and getRspackPluginFromRaw
src/rspack/index.ts
Extracts rspack hook wiring into applyRspackPlugins and adds getRspackPluginFromRaw for reuse by the Rsbuild adapter.
Rsbuild adapter implementation
src/rsbuild/index.ts, src/define.ts
Adds getRsbuildPlugin, builds Rsbuild plugins from unplugin factories, wires Rsbuild metadata/version handling, and exposes the adapter through createUnplugin().rsbuild and createRsbuildPlugin.
Test utilities, fixture configs, and unit tests
test/unit-tests/utils.ts, test/unit-tests/framework-version/index.test.ts, test/fixtures/*/rsbuild.config.mjs, test/fixtures/*/__test__/build.test.ts, scripts/buildFixtures.ts
Adds Rsbuild build helpers, fixture configs, assertions, framework/version tests, and fixture build steps for Rsbuild.
Documentation and docs-site
README.md, docs/index.md, docs/guide/index.md, docs/vite.config.ts, docs/.vitepress/theme/style.css
Updates supported-tool lists, examples, compatibility tables, homepage feature content, icon mapping, and feature image styling for Rsbuild.

Sequence Diagram(s)

sequenceDiagram
  participant PluginAuthor
  participant createRsbuildPlugin
  participant getRsbuildPlugin
  participant toRsbuildPlugin
  participant RsbuildAPI
  participant getRspackPluginFromRaw

  PluginAuthor->>createRsbuildPlugin: UnpluginFactory
  createRsbuildPlugin->>getRsbuildPlugin: factory
  getRsbuildPlugin->>getRsbuildPlugin: build meta {framework:'rsbuild'}
  getRsbuildPlugin->>toRsbuildPlugin: rawPlugin[]
  toRsbuildPlugin-->>PluginAuthor: RsbuildPlugin
  PluginAuthor->>RsbuildAPI: register via rsbuild.config
  RsbuildAPI->>toRsbuildPlugin: setup(api)
  toRsbuildPlugin->>toRsbuildPlugin: meta.versions.rsbuild = api.context.version
  toRsbuildPlugin->>getRspackPluginFromRaw: rawPlugin[]
  getRspackPluginFromRaw->>RsbuildAPI: RspackPlugin
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐇 Hop, hop, the Rsbuild moon is bright,
New adapters twinkle in the night.
Rspack paths now share their trail,
Tests and docs join bunny sail. 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding a Rsbuild adapter.
Linked Issues check ✅ Passed The changes implement first-class Rsbuild support, including createRsbuildPlugin and createUnplugin(...).rsbuild, matching issue #607.
Out of Scope Changes check ✅ Passed The extra docs, tests, and build/config updates all support the Rsbuild adapter work and appear in scope.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Jun 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/unplugin@608

commit: 7f9028b

@sxzz sxzz merged commit 791fb7b into unjs:main Jun 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add first-class Rsbuild adapter

2 participants